package com.atwulidun.decorator07;

public class DecoratorDemo {
    public static void main(String[] args) {
        // 点一份Espresso咖啡
        Drink order = new Espresso();
        System.out.println("点一份" + order.getDes() + "咖啡，花费" + order.cost() + "元");
        // 加一份牛奶
        order = new Milk(order);
        System.out.println("点一份" + order.getDes() + "一共花费" + order.cost() + "元");
        // 加一份糖(这里是对咖啡和牛奶组成的整体进行装饰)
        order = new Sugar(order);
        System.out.println("点一份" + order.getDes() + "一共花费" + order.cost() + "元");
        // 加一份豆浆(这里是对咖啡、牛奶和糖组成的整体进行装饰)
        order = new Soy(order);
        System.out.println("点一份" + order.getDes() + "一共花费" + order.cost() + "元");
    }
}
